1cb93a386Sopenharmony_ci/* 2cb93a386Sopenharmony_ci * Copyright 2021 Red Hat, Inc 3cb93a386Sopenharmony_ci * 4cb93a386Sopenharmony_ci * This is part of HarfBuzz, a text shaping library. 5cb93a386Sopenharmony_ci * 6cb93a386Sopenharmony_ci * Permission is hereby granted, without written agreement and without 7cb93a386Sopenharmony_ci * license or royalty fees, to use, copy, modify, and distribute this 8cb93a386Sopenharmony_ci * software and its documentation for any purpose, provided that the 9cb93a386Sopenharmony_ci * above copyright notice and the following two paragraphs appear in 10cb93a386Sopenharmony_ci * all copies of this software. 11cb93a386Sopenharmony_ci * 12cb93a386Sopenharmony_ci * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 13cb93a386Sopenharmony_ci * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 14cb93a386Sopenharmony_ci * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 15cb93a386Sopenharmony_ci * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 16cb93a386Sopenharmony_ci * DAMAGE. 17cb93a386Sopenharmony_ci * 18cb93a386Sopenharmony_ci * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 19cb93a386Sopenharmony_ci * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20cb93a386Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 21cb93a386Sopenharmony_ci * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 22cb93a386Sopenharmony_ci * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 23cb93a386Sopenharmony_ci * 24cb93a386Sopenharmony_ci * Author(s): Matthias Clasen 25cb93a386Sopenharmony_ci */ 26cb93a386Sopenharmony_ci 27cb93a386Sopenharmony_ci#include "hb-test.h" 28cb93a386Sopenharmony_ci 29cb93a386Sopenharmony_ci#include <hb.h> 30cb93a386Sopenharmony_ci 31cb93a386Sopenharmony_ci/* test for https://github.com/harfbuzz/harfbuzz/issues/3274 */ 32cb93a386Sopenharmony_ci 33cb93a386Sopenharmony_cistatic void 34cb93a386Sopenharmony_citest_hb_scale (void) 35cb93a386Sopenharmony_ci{ 36cb93a386Sopenharmony_ci hb_face_t *face = hb_test_open_font_file ("fonts/Cantarell.A.otf"); 37cb93a386Sopenharmony_ci hb_font_t *font1 = hb_font_create (face); 38cb93a386Sopenharmony_ci hb_font_t *font2 = hb_font_create (face); 39cb93a386Sopenharmony_ci 40cb93a386Sopenharmony_ci double scale = 64 * 1024 * 96./72.; 41cb93a386Sopenharmony_ci hb_font_set_scale (font1, scale, scale); 42cb93a386Sopenharmony_ci hb_font_set_scale (font2, - scale, - scale); 43cb93a386Sopenharmony_ci 44cb93a386Sopenharmony_ci g_assert_cmpint (hb_font_get_glyph_h_advance (font1, 1), ==, - hb_font_get_glyph_h_advance (font2, 1)); 45cb93a386Sopenharmony_ci 46cb93a386Sopenharmony_ci hb_font_destroy (font1); 47cb93a386Sopenharmony_ci hb_font_destroy (font2); 48cb93a386Sopenharmony_ci hb_face_destroy (face); 49cb93a386Sopenharmony_ci} 50cb93a386Sopenharmony_ci 51cb93a386Sopenharmony_ciint 52cb93a386Sopenharmony_cimain (int argc, char **argv) 53cb93a386Sopenharmony_ci{ 54cb93a386Sopenharmony_ci hb_test_init (&argc, &argv); 55cb93a386Sopenharmony_ci hb_test_add (test_hb_scale); 56cb93a386Sopenharmony_ci return hb_test_run (); 57cb93a386Sopenharmony_ci} 58