This refers to the "gm" extension for node, http://aheckmann.imtqy.com/gm/docs.html
I need to add text centered around a bounding box (horizontal enough). The drawText () function requires x, y coordinates, but there is no way to draw centered text.
I otherwise need a function that can return the width of the text string in the specified font / size, so I can calculate the starting position x in javascript before calling drawText ().
You can use the region and gravity functions as follows:
region
gravity
gm(filePath) .region(WIDTH, HEIGHT, X, Y) .gravity('Center') .fill(color) .fontSize(textFontSize) .font(font) .drawText(0, 0, 'This text will be centered inside the region')
Source: https://habr.com/ru/post/1247443/More articles:No member function member error inside lambda expression? - c ++Linear Algorithm - javascriptScattering numbers in javascript array - javascriptPython 3, super .__ del __ () - pythonAdding a Filter to Grizzly FilterChain in Glassfish - glassfishVS2015 C # interactive: error CS7069: a reference to the "Object" type claims to be defined in "System.Runtime", but could not be found - c #Fire $ ngAnimate enter after fulfillment of promise - javascriptIonic2 - check if the page is active - angularDoes Spark count records in an expensive RDD task? - javaAndroid CollapsingToolbarLayout without a toolbar to stop at a specific point and not completely close - androidAll Articles