/// <summary> /// SendLink sends a typed link annotation to the handler. /// </summary> /// <param name="handler">The handler.</param> /// <param name="oiGroup">The group.</param> /// <param name="oiIndex">The index.</param> /// <param name="bounds">The rectangle surrouding the annotation.</param> /// <returns>true if the operation succeeded otherwise returns false.</returns> private static bool SendLink( IWangAnnotationHandler handler, string oiGroup, string oiIndex, int[] bounds, int orientation, uint creationScale, string text, bool internalLink, string link, string workingDirectory, string location, byte[] color, WangLogFont lfFont) { // TODO - David Ometto - 2016-11-22 - Translate to GdPicture.NET proper annotation type. // Please see in detail the parameters that are just ignored for the moment. // Take extra care of each and every field of the WangLogFont and WangDisplayText structures. // TODO - David Ometto - 2016-11-22 - This definitely does not work. Having a try with a pdf // output: the text is there, underlined and blue ... but not link. Tested with www.orpalis.com. // Also the link to files, etc. needs to be analysed to understand how to combine the different // components. if (internalLink) { handler.AddLinkAnnot(bounds[WangAnnotationTranslation.LeftIndex], bounds[WangAnnotationTranslation.TopIndex], bounds[WangAnnotationTranslation.RightIndex] - bounds[WangAnnotationTranslation.LeftIndex], bounds[WangAnnotationTranslation.BottomIndex] - bounds[WangAnnotationTranslation.TopIndex], text, workingDirectory + link + location); } else { handler.AddLinkAnnot(bounds[WangAnnotationTranslation.LeftIndex], bounds[WangAnnotationTranslation.TopIndex], bounds[WangAnnotationTranslation.RightIndex] - bounds[WangAnnotationTranslation.LeftIndex], bounds[WangAnnotationTranslation.BottomIndex] - bounds[WangAnnotationTranslation.TopIndex], text, link); } return(true); }
/// <summary> /// SendTextFromFile sends a text from file annotation to the handler. /// </summary> /// <param name="handler">The handler.</param> /// <param name="oiGroup">The group.</param> /// <param name="oiIndex">The index.</param> private static void SendTextFromFile( IWangAnnotationHandler handler, string oiGroup, string oiIndex, int[] bounds, int orientation, uint creationScale, string text, byte[] color, WangLogFont lfFont) { // TODO - David Ometto - 2016-11-22 - Translate to GdPicture.NET proper annotation type. // Please see in detail the parameters that are just ignored for the moment. // Take extra care of each and every field of the WangLogFont and WangDisplayText structures. handler.AddTextAnnot(bounds[WangAnnotationTranslation.LeftIndex], bounds[WangAnnotationTranslation.TopIndex], bounds[WangAnnotationTranslation.RightIndex] - bounds[WangAnnotationTranslation.LeftIndex], bounds[WangAnnotationTranslation.BottomIndex] - bounds[WangAnnotationTranslation.TopIndex], text, lfFont.Italic, lfFont.Underline, lfFont.FaceName, orientation / 10); }
/// <summary> /// ReadLogFont reads a structure designed to hold font attributes. /// </summary> /// <remarks> /// This methods aplies when the specifications are mentionning the availability of a OIAN_MARK_ATTRIBUTES structure. /// </remarks> /// <param name="stream">The stream to read the data in.</param> /// <returns>The data read.</returns> public static WangLogFont ReadLogfont(IWangStream stream) { if (stream.AvailableBytes() >= 56) { /* * This implementation is based on the following C++ typedef: * typedef struct tagLOGFONT { * LONG lfHeight; * LONG lfWidth; * LONG lfEscapement; * LONG lfOrientation; * LONG lfWeight; * BYTE lfItalic; * BYTE lfUnderline; * BYTE lfStrikeOut; * BYTE lfCharSet; * BYTE lfOutPrecision; * BYTE lfClipPrecision; * BYTE lfQuality; * BYTE lfPitchAndFamily; * TCHAR lfFaceName[LF_FACESIZE]; * } LOGFONT, *PLOGFONT; */ WangLogFont readData = new WangLogFont(); readData.Height = stream.ReadInt32(); readData.Width = stream.ReadInt32(); readData.Escapement = stream.ReadInt32(); readData.Orientation = stream.ReadInt32(); readData.Weight = stream.ReadInt32(); readData.Italic = stream.ReadByte() != 0; readData.Underline = stream.ReadByte() != 0; readData.StrikeOut = stream.ReadByte() != 0; readData.CharSet = stream.ReadByte(); readData.OutPrecision = stream.ReadByte(); readData.ClipPrecision = stream.ReadByte(); readData.Quality = stream.ReadByte(); readData.PitchAndFamily = stream.ReadByte(); readData.FaceName = ReadCharString(stream, 28); return(readData); } return(null); }